package com.etlmaster.executor.steps.mail;

import java.io.File;
import java.util.Properties;

import com.etlmaster.executor.StepMeta;
import com.etlmaster.executor.utils.DataCollectionUtils;

public class SendMailStepMeta extends StepMeta {
	public SendMailStepMeta(String id, String name,String step_code, String session_id, String paramStr) {
		super(id, name,step_code, session_id, paramStr);
	}
	
	private String mailServerHost = DataCollectionUtils.getProperties(
			"mailServer");;

	private String mailServerPort = "25";

	
	private String fromAddress = DataCollectionUtils.getProperties(
			"senderEmail");

	
	private String toAddress;

	
	private String toAddresscc;

	
	private String userName = DataCollectionUtils.getProperties(
			"senderUserName");

	
	private String password = DataCollectionUtils.getProperties(
			"senderPassword");

	
	private boolean validate = true;

	
	private boolean isHtml = true;

	
	private String subject ;

	
	private String content;

	
	private String attachFileNames;

	
	private String charset="utf-8";

	
	private File files;

	private String suffix=DataCollectionUtils.getProperties(
			"mailSuffix");
	public Properties getProperties() {
		Properties p = new Properties();
		p.put("mail.smtp.host", this.mailServerHost);
		p.put("mail.smtp.port", this.mailServerPort);
		p.put("mail.smtp.auth", validate ? "true" : "false");
		return p;
	}

	public String getMailServerHost() {
		return mailServerHost;
	}

	public void setMailServerHost(String mailServerHost) {
		this.mailServerHost = mailServerHost;
	}

	public String getMailServerPort() {
		return mailServerPort;
	}

	public void setMailServerPort(String mailServerPort) {
		this.mailServerPort = mailServerPort;
	}

	public boolean isValidate() {
		return validate;
	}

	public void setValidate(boolean validate) {
		this.validate = validate;
	}

	public String getAttachFileNames() {
		return attachFileNames;
	}

	public void setAttachFileNames(String fileNames) {
		this.attachFileNames = fileNames;
	}

	public String getFromAddress() {
		return fromAddress;
	}

	public void setFromAddress(String fromAddress) {
		this.fromAddress = fromAddress;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getToAddress() {
		return toAddress;
	}

	public void setToAddress(String toAddress) {
		this.toAddress = toAddress;
	}

	public String getToAddresscc() {
		return toAddresscc;
	}

	public void setToAddresscc(String toAddresscc) {
		this.toAddresscc = toAddresscc;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getSubject() {
		return DataCollectionUtils.getProperties("mailSubject")+this.variableSubstitution(subject);
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getContent() {
		return this.variableSubstitution(content);
	}

	public void setContent(String textContent) {
		this.content = textContent;
	}

	public String getCharset() {
		return charset;
	}

	public void setCharset(String charset) {
		this.charset = charset;
	}

	public boolean isHtml() {
		return isHtml;
	}

	public void setHtml(boolean isHtml) {
		this.isHtml = isHtml;
	}

	public File getFiles() {
		return files;
	}

	public void setFiles(File files) {
		this.files = files;
	}

	@Override
	protected void loadParamsFromConfigTable() {
		// TODO Auto-generated method stub

	}

	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}

}
